﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Web_UptDdhb : System.Web.UI.Page
{
    private string num = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        num = Request.QueryString["Num"];
        if (!IsPostBack)
        {
            btnUpt.Attributes.Add("onclick", "javascript:if(confirm('" + "确认无误，并修改么？" + "')== false) return false;");
            DataSet ds = BLLFactory.CreateDdhbBLL().Select(num);
            if (ds == null)
                Response.Write(" <script   language=javascript> window.alert( '无此记录，请联系管理员！ ');</script> ");
            else
            {
                txtNUM.Text = num;
                txtNUM.Attributes["contentEditable"] = "false";
                txtBanbie.Text = ds.Tables[0].Rows[0]["banbie"].ToString();
                txtBanzu.Text = ds.Tables[0].Rows[0]["banzu"].ToString();
                txtWb.Text = ds.Tables[0].Rows[0]["wb"].ToString();
                txtSc.Text = ds.Tables[0].Rows[0]["sc"].ToString();
                txtSb.Text = ds.Tables[0].Rows[0]["sb"].ToString();
                txtZl.Text = ds.Tables[0].Rows[0]["zl"].ToString();
                txtAq.Text = ds.Tables[0].Rows[0]["aq"].ToString();
            }
        }
        
    }
    protected void btnUpt_Click(object sender, EventArgs e)
    {
        int f = BLLFactory.CreateDdhbBLL().UpdateDdhb(num, txtBanbie.Text.ToString(), txtBanzu.Text.ToString(), txtWb.Text.ToString(), txtSc.Text.ToString(), txtSb.Text.ToString(), txtZl.Text.ToString(), txtAq.Text.ToString());
        if (f >= 1)
            Response.Write(" <script   language=javascript> window.alert( ' 修改成功！ ');</script> ");
        Response.Redirect("DDHBJL.aspx");
    }
    protected void btnDel_Click(object sender, EventArgs e)
    {
        int f = BLLFactory.CreateDdhbBLL().Del(num);
        if (f >= 1)
            Response.Write(" <script   language=javascript> window.alert( ' 删除成功！ ');</script> ");
        Response.Redirect("DDHBJL.aspx");
    }
}
